package com.estar.integaration.Reader;

import com.alibaba.excel.EasyExcel;
import com.estar.integaration.Reader.Listener.DueReceiptDetailListener;
import com.estar.integaration.Reader.Listener.ReceiptComeLedgerListener;
import com.estar.integaration.entity.paymentPlanEntity.ReceiptComeLedger;
import com.estar.integaration.entity.paymentPlanEntity.ReceiptComeLedger;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: YJL
 * Date: 2022/2/17 15:45
 * 发票到票台账.xlsx
 **/
public class ReceiptComeLedgerReader {

  List<String> addresses = new ArrayList<>();
  List<ReceiptComeLedger> receiptComeLedgerList = new ArrayList<>();

  public ReceiptComeLedgerReader(List<String> addresses) {
    this.addresses = addresses;
  }

  public List<ReceiptComeLedger> readReceiptComeLedger(){
    for(String address : addresses){
      List<ReceiptComeLedger> tmpList = new ArrayList<>();
      EasyExcel.read(address,ReceiptComeLedger.class,new ReceiptComeLedgerListener(tmpList))
          .sheet(0)
          .headRowNumber(1)
          .doRead();
      receiptComeLedgerList.addAll(tmpList);
    }
    return receiptComeLedgerList;
  }

}
